const Generator = require('yeoman-generator');


module.exports = class extends Generator {
    promptting () {
        return this.prompt([
            {
                type: 'input',
                name: 'name',
                message: 'Your Project',
                default: this.appname
            }
        ]).then(answes=>{
            this.answes = answes
        })
    }
    writting(){
        const templates = [
            '.babelrc',
            '.gitignore',
            'package.json',
            'postcss.config.js',
            'README.md',
            'webpack.common.js',
            'webpack.dev.js',
            'webpack.prod.js',
            'public/index.html',
            'public/assets/react.png',
            'src/app.js',
            'src/index.css',
            'src/index.js',
        ]
        templates.forEach(item =>{
            this.fs.copyTpl(
                this.templatePath(item),
                this.destinationPath(item),
                this.answes
            )
        })

    }
}

